<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Markdown Editor</title>
        <link rel="stylesheet" href="style/nav.css" >
        <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
        <link rel="stylesheet" href="css/bootstrap.min.css">
    
        <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
        <link rel="stylesheet" href="css/bootstrap-theme.min.css">
    
        <!-- editor.md的css文件 -->
        <link rel="stylesheet" href="plugs/editormd/css/editormd.css" />
        <link rel="stylesheet" href="plugs/editormd/css/editormd.preview.min.css" />
    
        <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
        <script src="js/jquery-3.3.1.min.js"></script>
        <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
        <script src="js/bootstrap.min.js"></script>
        <script src="js/myajax.js"></script>
        <script src="js/jquery.media.js"></script>
        <!-- editor.md的js文件 -->
        <script src="plugs/editormd/lib/marked.min.js"></script>
        <script src="plugs/editormd/lib/prettify.min.js"></script>
        <script src="plugs/editormd/lib/raphael.min.js"></script>
        <script src="plugs/editormd/lib/underscore.min.js"></script>
        <script src="plugs/editormd/editormd.js"></script>
    </head>
    <body>
        <div id="test-editormd"></div>
    </body>
<script>
    var md = "";
    if (localStorage.getItem("mdNotebook") != null) {
        md= localStorage.getItem("mdNotebook").toString();
    };
    var testEditor = editormd("test-editormd", {
                width: "100%",
                height: 740,
                path : 'plugs/editormd/lib/',
                markdown : md,
                codeFold : true,
                saveHTMLToTextarea : true,
                searchReplace : true,
                emoji : true,
                taskList : true,
                tex : true,                   // 开启科学公式TeX语言支持，默认关闭
                imageUpload : true,
                imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
                imageUploadURL : "./php/upload.php",
                onload : function() {
                    //this.fullscreen();
                    //this.unwatch();
                    //this.watch().fullscreen();

                    //this.setMarkdown("#PHP");
                    //this.width("100%");
                    //this.height(480);
                    //this.resize("100%", 640);
                }
            });
    testEditor.katexURL = {
        css: "//localhost/css/katex.min",
        js:  "//localhost/js/katex.min"
    };
    document.onkeydown = function(e) {
        var keyNum = window.event? e.keyCode : e.which;
        if (e.keyCode==83 && e.ctrlKey) {
            e.preventDefault();
            localStorage.setItem("mdNotebook", testEditor.getMarkdown());
        }
    }
</script>
</html>